package cn.wolfcode.car.business.qo;

import cn.wolfcode.car.common.base.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Calendar;
import java.util.Date;

@Setter
@Getter
public class CarPackageAuditQueryObject extends QueryObject {

    private String creatName;       // 创建人名称
    private Long auditorId;         // 审核人 id
    private Integer status;         // 审核状态
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginTime;         // 开始时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endTime;           // 结束时间
    private String auditorName;     // 审核人姓名

    public Date getEndTime() {
        if (endTime != null) {
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(endTime);
            calendar.add(Calendar.DAY_OF_MONTH,1);
            calendar.add(Calendar.SECOND,-1);
            return calendar.getTime();
        }
        return null;
    }
}
